import { ElMessage } from "element-plus";
import { ref } from "vue";
import { createWebHashHistory, createRouter } from "vue-router";

const routes = [
    {
        path: '/',
        redirect: '/login',
    },
    {
        path: '/login',
        name: 'login',
        component: () => import("../components/Login.vue")
    },
    {
        path: '/index',
        component: () => import('../components/Index.vue'),
        children: [
            {
                path: '/user',
                name: 'user',
                component: () => import('../views/User.vue'),
                meta: {
                    requireAuth: true,
                }
            },
            {
                path: '/vote',
                name: 'vote',
                component: () => import('../views/Vote.vue'),
                meta: {
                    requireAuth: true,
                }
            },
            {
                path: '/type',
                name: 'type',
                component: () => import('../views/Type.vue'),
                meta: {
                    requireAuth: true,
                }
            },
            {
                path: '/record',
                name: 'record',
                component: () => import('../views/record.vue'),
                meta: {
                    requireAuth: true,
                }
            },
            {
                path: '/voteFront',
                name: 'voteFront',
                component: () => import('../views/VoteFront.vue'),
            },
            {
                path: '/voteRanking',
                name: 'voteRanking',
                component: () => import('../views/VoteRanking.vue'),
            },
            {
                path: '/hotVote',
                name: 'hotVote',
                component: () => import('../views/HotVote.vue'),
            },
            {
                path: '/person',
                name: 'person',
                component: () => import('../views/Person.vue'),
                meta: {
                    requireAuth: true,
                }
            }
        ]
    },
]
const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;